package com.stone.name.space.parser;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
import java.util.List;

/**
 * <p>Created with IntelliJ IDEA. </p>
 * <p>User: Stony </p>
 * <p>Date: 2016/6/24 </p>
 * <p>Time: 10:53 </p>
 * <p>Version: 1.0 </p>
 */
public class RedBeanDefinitionParser extends AbstractBeanDefinitionParser {

    public RedBeanDefinitionParser(Class<?> beanClass, boolean required) {
       super(beanClass,required);
    }


    @Override
    public BeanDefinition parse(Element element, ParserContext parserContext, Class<?> beanClass, boolean required) {
        RootBeanDefinition beanDefinition = getBaseRootBeanDefinition(element, parserContext, beanClass, required);
        String _slist = element.getAttribute("server-lists");
        beanDefinition.getPropertyValues().addPropertyValue("serverLists", _slist);
        return beanDefinition;
    }
}
